#ifndef BILATERALAUDIOPLAY_H
#define BILATERALAUDIOPLAY_H

#include <QAudioInput>
#include <QAudioSink>
#include <QAudioSource>
#include <QMediaDevices>
#include <QObject>
#include "mircrophoneiodevice.h"
class bilateralAudioPlay : public QObject
{
    Q_OBJECT
public:
    explicit bilateralAudioPlay(QObject *parent = nullptr);
    QVector<QString> getIntputDevicesDescription();
    void selectInputAudioDevice(int index);
    void start();
    void stop();
signals:

protected:
    void onIntputAudioVolumeChange(float volume);

private:
    QMediaDevices *MediaDevices;
    QAudioSink *audioSinkOutput;
    MircrophoneIODevice *mircrPhoneIODevice;
    QList<QAudioDevice> intputAudioDevices; //这是包含的输入设备的列表
    QAudioDevice selectIntputAudioDevice;   //这是选择的输入设备
    QAudioDevice defalutOutputAudioDevice;  //这是默认的输出设备
    QVector<QString> intputDevicesDescription;
    QAudioSource *audioSource; //这是输入源
    QAudioFormat format;       //这是输入和输出使用的统一的格式
    float outPutVolume; //这是当还没有开启测试时，移动了滑块，需要先记录滑块的音量，因为还没有开始初始化audioSinkOutput
};

#endif // BILATERALAUDIOPLAY_H
